def deposit(balance, amount):
    return balance + amount

def withdraw(balance, amount):
    if amount > balance:
        print("余额不足，无法取款！")
    else:
        balance -= amount
    return balance

def check_balance(balance):
    return balance

def atm_system():

    balance = float(input("请输入初始账户余额: "))
    while True:
        print("\n请选择操作：")
        print("1. 存款")
        print("2. 取款")
        print("3. 查询余额")
        print("输入 'exit' 退出程序")
        choice = input("请输入操作选项: ")

        if choice == "1":
            amount = float(input("请输入存款金额: "))
            balance = deposit(balance, amount)
            print(f"存款成功！当前余额: {balance:.2f}")
        elif choice == "2":
            amount = float(input("请输入取款金额: "))
            balance = withdraw(balance, amount)
            print(f"取款成功！当前余额: {balance:.2f}")
        elif choice == "3":
            print(f"当前余额: {check_balance(balance):.2f}")
        elif choice.lower() == "exit":
            print("退出程序。")
            break
        else:
            print("无效输入，请重新选择！")

